package com.cosc716.restaurant.domain;

import java.util.ArrayList;
import java.util.Random;


public class OrderItem {

	private String itemName;
	private int quantity;
	private double totalprice;
	private MenuItem item;
	private int preptime;
	private String prepstatus;
	Random ran=new Random();
	Menu menu=new Menu();

	public OrderItem()
	{
	
		int size=menu.getsize();
		int index=ran.nextInt(size);
		item=menu.getitem(index);
		quantity=ran.nextInt(20)+1;
		preptime=ran.nextInt(20) + 10;
		itemName=item.getName();
		
		}
	
	
	
	public double getTotalPrice()
	{
		
 totalprice=item.getPrice()*quantity;	
		return totalprice;
	}
public String getItemName()
{
	return itemName;
}

public int getQuantity()
{
 return quantity;
}
public void prepare()
{
	if(preptime>0)
		preptime--;
	}
public int getPreptime()
{
return preptime;	
}
 public String getPrepstatus()
 {
	 return prepstatus;
 }
public String toString()
	{
		String result=itemName +"\t" +quantity+"\t"+ getTotalPrice()+"\t"+"Preparation time "+preptime+"\n";
		return result;
		
	}
}
